import { request, METHOD } from '@/utils/services/request'
import { LOGIN, GETINFO, GET_ROUTERS, LOGIN_OUT } from '@/services/api'


/**
 * 登陆
 * @returns {Promise<AxiosResponse<T>>}
 */
export async function Login (data) {
  return request(LOGIN, METHOD.POST, data)
}

/**
 * 登出
 * @returns {Promise<AxiosResponse<T>>}
 */
export async function logout () {
  return request(`${LOGIN_OUT}`, METHOD.POST)
}


/**
 * 获取用户信息
 * @returns {Promise<AxiosResponse<T>>}
 */
export async function getInfo (data) {
  return request(GETINFO, METHOD.GET, data)
}

/**
 * 获取路由
 * @returns {Promise<AxiosResponse<T>>}
 */
export async function getRouters (data) {
  return request(GET_ROUTERS, METHOD.GET, data)
}


